<div>
	<div id="root-html">
		<style>
			.hide {
				display: none !important;
			}
		</style>
		<div class="titles fiex" style="height: 0;"></div>
		<div id="root-box" style="background: #eeeeee;">
			<div id="roo_warp"></div>

			<div id="gps_box"></div>

		</div>

		<script type="text/html" id="root-js">
			{{if gonggao}}
			<div class="sys_notice" id="sys_notice">
				<div class="scroll1 " id="scroll_top" style="margin-right: 2em; overflow: hidden;">
					<p class="ellipsis">{{gonggao}}</p>
					<div class="neirong"></div>
				</div>
				<i class="close">X</i>
			</div>
			<div class="sys_notice_height"></div>
			{{/if}}

			<div class="shop_art" style="background: #fff;">
				<div class="table-top fiex">
					<a href="javascript:;" onclick="gotoapp()" class="black">
						<svg class="g2">
							<use xlink:href="#f_black"></use>
						</svg>
					</a>
					<div class="lang-xiala" id="lang-xiala"></div>

					<div class="table">
						<span data-l="1050" class="f-30"></span><span class="f-50 mag-l-10">{{shop_table_name}}</span>
					</div>
					<img src="/images/null.gif" data-src="{{shop_info.shop_thumb}}?x-oss-process=image/resize,m_fill,h_300,w_600" style="width: 100%; height: 3.8rem;" />
				</div>

				<div class="w">
					<div class="shop-head cf">
						<div class="icon fl mag-r-20"><img src="/images/null.gif" data-src="{{shop_info.shop_logo}}?x-oss-process=image/resize,m_fill,h_100,w_100" /></div>
						<div class="oh">
							<div class="f-40">{{shop_info.shop_name}}</div>
							<div class="mag-t-10 pad-t-10 aaa">
								<svg class="g2" style="fill: #aaa;">
									<use xlink:href="#f_gps"></use>
								</svg>
								<span id="gpsjuli" style="cursor: pointer;" onclick="setmap1(1)">{{juli}}</span>
							</div>
						</div>
					</div>
				</div>
			</div>

			<div class="pos-icon cf" style="background: #fff;">
				<div class="fr fiex">
					<a href="tel:{{shop_info.mobile}}" class="fiex1">
						<svg class="g2">
							<use xlink:href="#f_phone"></use>
						</svg>
					</a>
				</div>
				<div class="oh fiex pad-l-20">

					<div class="fiex1 ">
						<a href="#!map-html?shop_name={{shop_info.shop_name}}&gps={{shop_info.position}}">
							<img src="/images/null.gif" data-src="/images/ditu.png" /></a>
					</div>
					<div class="fiex8">
						<p>
							<a href="#!map-html?shop_name={{shop_info.shop_name}}&gps={{shop_info.position}}">
								{{shop_info.shop_address}}
							</a>
						</p>
					</div>

				</div>
			</div>

			<div class="root-bon cf fiex" style="background: #fff;">
				<div class="bon bon1 fiex1">
					<a href="javascript:;" data-cookbook="{{cookbook_list[0].id}}" class="fiex">
						<div class="svg">
							<svg class="g2">
								<use xlink:href="#f_diancai"></use>
							</svg>
						</div>
						<div class=" fiex  f-24"><em class="fiex1" data-l="1002"></em></div>
					</a>
				</div>
				<div class="bon bon2 fiex1">
					<a href="javascript:;" class="fiex {{if count==0}}null{{/if}}" id="yidian">
						<div class="svg">
							<svg class="g2">
								<use xlink:href="#f_dingdan"></use>
							</svg>
						</div>
						<div class=" fiex  f-24"><em class="fiex1" data-l="1003"></em> </div>
						<span>{{count}}</span>
					</a>
				</div>
				<div class="bon bon3 fiex1">
					<a href="javascript:;" class="fiex" id="hujiao">
						<div class="svg">
							<svg class="g2">
								<use xlink:href="#f_hujiao"></use>
							</svg>
						</div>
						<div class="fiex  f-24 p1"><em class="fiex1" data-l="1043"></em></div>
						<div class="fiex  f-24 p2"><em class="fiex1">30s</em></div>
					</a>
				</div>

				<div class="bon bon4 fiex1" {{if shop_info.is_maidan_type==0}}style="display:none;" {{/if}}>
					<a href="javascript:;" class="fiex" id="maidan">
						<div class="svg">
							<svg class="g2">
								<use xlink:href="#f_7"></use>
							</svg>
						</div>
						<div class="fiex  f-24 p1"><em class="fiex1" data-l="1203"></em></div>
						<div class="fiex  f-24 p2"><em class="fiex1">30s</em></div>
					</a>
				</div>

			</div>

			{{if point>0}}
			<div class="bankgray"></div>
			<div class=" pad-10 center fiex" style="background: #fff;">
				<div class="fiex1">
					<img style="width: 0.8rem; height: 0.8rem;" src="/images/null.gif" data-src="/images/m_03.png">
				</div>
				<div class="fiex2">
					<span data-l="1174" class="mag-t-10"></span>
					<span class="red f-bold f-30" id="point">{{point}}</span>
				</div>
				<div class="fiex1" id="getpoint">
					<div class="get mag-t-20 mag-b-20 f-30">
						<a href="#!bind_phone-html" class="bon-red" style="padding: 0.1rem;" data-l="1175"></a>
					</div>
				</div>
			</div>
			{{/if}}

			<div class="bankgray"></div>

			<div class="root-card cf" style="background: #fff; display: none !important;">
				<div class="item">
					<a href="#!coupon_art-html?id={{shop_info.id}}">
						<div class="w w1">
							<div class="tb">
								<img src="/images/null.gif" data-src="/images/m_07.png">
								<span data-l="1157"></span>
							</div>
						</div>
					</a>
				</div>
				<div class="item">
					<a href="#!vipcard_art-html?id={{shop_info.id}}&member_card={{member_card_id}}&open_card={{shop_info.shop_member_card_open}}">
						<div class="w w2">
							<div class="tb">
								<img src="/images/null.gif" data-src="/images/m_05.png">
								<span data-l="1156"></span>
							</div>
						</div>
					</a>
				</div>

			</div>

			<div class="main-gg cf" style="display: none;">
				<img src="/images/null.gif" class="gg" data-src="/images/g1.png?123" />
			</div>

			<div class="game-list pad-20">
				<div class="game_weix" style="display: none;">
					<img src="/images/null.gif" data-src="/images/g1.png" style="width: 100%; height: auto;" />
				</div>
				<div class="game_app" style="display: none;">
					<a href="javascript:;" class="bk g1 mag-b-20">
						<img src="/images/null.gif" data-src="/images/g2.png" style="width: 100%; height: auto;" />
					</a>
					<a href="javascript:;" class="bk g2 mag-b-20">
						<img src="/images/null.gif" data-src="/images/g3.png" style="width: 100%; height: auto;" />
					</a>
				</div>
			</div>

			<div class="bank50"></div>
		</script>
		<script type="text/html" id="lang-xial-js">
			<span class="l">&nbsp;</span>
			<svg class="g2">
				<use xlink:href="#f_xiala"></use>
			</svg>
			<div class="child">
				{{each lan as v i}}
				<a href="javascript:;" class="a {{if v.value==set}}on{{/if}}" data-lan="{{v.value}}">{{v.title}}</a>
				{{/each}}
			</div>
		</script>
		<script type="text/html" id="menu-list">
			<div class="menu-cookbook" id="menu-cookbook">
				<div class="box">
					<div class="close">X</div>
					<div class="list">
						<div class="list-scroll">
							{{each cookbook_list as v i}} {{if v.time_is !=1 || v.is_table !=1 || v.is_select !=1}}
							<a href="javascript:;" data-cookbook="{{v.id}}" class="null" style="background-image: url({{oss}}/{{v.thumb}}?x-oss-process=image/resize,m_fill,h_600,w_280); opacity: 0.8;">
								{{if v.is_select==0}}
								<span data-l="1201"></span> {{else if v.time_is==0}}
								<span data-l="1148"></span> {{else if v.is_table==0}}
								<span data-l="1194"></span> {{/if}}
								<em>{{v.cookbook_name}}</em>

							</a>
							{{else}}
							<a href="javascript:;" data-cookbook="{{v.id}}" style="background-image: url({{oss}}/{{v.thumb}}?x-oss-process=image/resize,m_fill,h_600,w_280);">
								<em>{{v.cookbook_name}}</em>
							</a>
							{{/if}} {{/each}}
						</div>
					</div>
				</div>
			</div>
		</script>

		<!--GPS模板-->
		<script id="gps_box_js1" type="text/html">
			<div class="gps_box">
				<div class="gps_imt"><img src="../images/a1.png" /></div>
				<div class="f-40 center mag-b-30">{{l.n1}}</div>
				<div class="center mag-b-30 f-30">{{l.n2}}</div>
				<div class="center">
					<a href="javascript:;" id="open_gps" class="bon-green f-30" style="padding: 0.2rem .5rem;">{{l.n3}}</a>
				</div>
				<div class="bank100"></div>
				<div class="mag-t-50 center f-30 mag-b-30">
					<a href="gpsscroll.html" style="color: #fff; text-decoration: underline;">{{l.n4}}</a>
				</div>
			</div>
		</script>

		<script id="gps_box_js2" type="text/html">
			<div class="gps_box_2">
				<div class="w w1">
					<div class="gps_imt"><img src="../images/a1.png" /></div>
					<div class="f-40 center mag-b-30">{{l.n5}}{{name}}</div>
					<div class="red f-40 center mag-b-10">{{km}}</div>
					<div class="">my: {{gps_l}},{{gps_x}}</div>
					<div class="center mag-b-30 f-28">{{l.n6}}</div>
					<div>
						<a href="javascript:;" class="bon-green f-26" style="padding: 0.2rem .5rem;" id="reload_gps">{{l.n7}}</a>
					</div>
				</div>
			</div>
		</script>

		<script id="gps_box_js3" type="text/html">
			<div class="gps_box_2">
				<div class="w w2">
					<div class="gps_imt"><img src="../images/a1.png" /></div>
					<div class="f-30 center mag-b-30">{{l.n8}}</div>
					<div class="center mag-b-30 f-36">{{name}}</div>
					<div>
						<a href="javascript:;" class="bon-green f-26" style="padding: 0.2rem .5rem;" id="reload_close">{{l.n9}}</a>
					</div>
				</div>
			</div>
		</script>

		<!--预约占用弹出层-->
		<div id="yuyuezhanyong">

		</div>
		<!--选择呼叫买单遮罩弹层-->
		<div id="elastic-layer" style="position: fixed; width: 100%; height: 100%; background: rgba(0,0,0,.8); z-index: 99999; top: 0;" class="hide"></div>
		<!--呼叫买单内容-->
		<script type="text/html" id="pay-box-teml">
			<div id="pay-box" style="position: absolute;z-index: 999999;top: 0; right: 0; bottom: 0; left: 0; margin: auto; width: 80%; text-align: center; display: table;" class="hide">
				<div id="pay" onclick="pay_fun()" style="background: #fff; padding: 20px 0; border-radius: 5px; margin-bottom: 40px;" data-l="1203">{{l.n10}}</div>
				<div id="call-waiter" onclick="call_waiter()" style="background: #fff; padding: 20px 0; border-radius: 5px;">{{l.n12}}</div>
			</div>
		</script>
		<div id="pay-box-html"></div>
		<script type="text/html" id="yuyuezhanyong_js">
			<div class="zhangyong-bg" style="position: fixed; z-index: 1000000; background: rgba(0,0,0,0.8); left: 0; top: 0; width: 100%; height: 100%;"></div>
			<div class="zhangyong-box" style="position: fixed; left: 10%; right: 10%; top: 50%; margin-top: -1em; background: #fff; border-radius: 20px; z-index: 10000001;">
				<div class="w pad-20 center f-18">
					{{l.n11}}
					<!--当前餐桌被预约，请联系服务员开桌。-->
				</div>
			</div>
		</script>

		<script>
			function gotoapp() {
				var wss1 = plus.webview.currentWebview().opener();
				wss1.close();
			}
			if(isAPP) {
				var wss2 = plus.webview.currentWebview().opener().opener();
				wss2.evalJS('refresh()')
			}
			//在线支付
			function pay_fun() {
				var ss = JSON.parse(localStorage.getItem("get_shop_home")),
					shop = ss.result;
				global_ajax(jsonpath + "put_pay_qrcode_url", "", function(e) {
					var m_code = e.result.url.split("sn=");
					close_elastic();
					clicked("./pay_1.html?shop_id=" + shop.shop_id + "&shop_table_id=" + shop.shop_table_id + "&sn=" + m_code[1]);
				})
			}
			//呼叫服务员买单（弹出层使用）
			function call_waiter() {
				maidan_fun();
			}
									function maidan_fun() { //呼叫买单不是线上支付
							var $th = $("#maidan");
							close_elastic();
							if($("span", "#yidian").text() >= 1) {} else {
								$.toast(lange[1204], "text")
								return false;
							}

							if($th.hasClass("open")) return false;
							$th.addClass("open");
							global_ajax(jsonpath + "put_call_waiter2", '', function(e) {
								var s1 = 30;
								$.toast(lange["1044"], "text");
								var s3 = setInterval(function() {
									s1--;
									$th.find(".p2 em").text(s1 + "s");
									if(s1 <= 0) {
										$th.removeClass("open")
										clearInterval(s3);
									}
								}, 1000)
							})
						}
						//开启买单弹层
						function elastic() {
							$("#elastic-layer").removeClass("hide");
							$("#pay-box").removeClass("hide");
						}
						//关闭买单弹层
						function close_elastic() {
							$("#elastic-layer").addClass("hide");
							$("#pay-box").addClass("hide");
						}
			//后添加语言包
			var serroot_lange = {
				"zh": {
					"n1": "无法获取到您的位置",
					"n2": "请开启定位服务，确保我们知道您已经在餐厅内！",
					"n3": "我已开启定位，重新获取位置",
					"n4": "如何开启定位服务?",
					"n5": "您距离",
					"n6": "您的位置距离餐厅较远，请到店内点餐",
					"n7": "我已到店里，重新获取位置",
					"n8": "欢迎光临",
					"n9": "开始点餐",
					"n10": "在线支付",
					"n11":"当前餐桌被预约，请联系服务员开桌。",
					"n12":"呼叫服务员"
				},
				"en": {
					"n1": "Unable to get to your location",
					"n2": "Please turn on location service and make sure we know you are in the restaurant!",
					"n3": "I have turned on positioning, reacquired position",
					"n4": "How do I turn on location service?",
					"n5": "You are away",
					"n6": "Your location is far from the restaurant. Please order it in the restaurant.",
					"n7": "I have arrived at the shop and regained my position",
					"n8": "Welcome Welcome",
					"n9": "Start ordering",
					"n10": "Online payments",
					"n11":"The current table is reserved, please contact the waiter to open the table.",
					"n12":"Call Waiter"
				},
				"ms": {
					"n1": "Tidak dapat sampai ke lokasi anda",
					"n2": "Sila aktifkan perkhidmatan lokasi dan pastikan kami tahu anda berada di restoran!",
					"n3": "Saya telah menghidupkan kedudukan, mengambil semula kedudukan",
					"n4": "Bagaimana saya menghidupkan perkhidmatan lokasi?",
					"n5": "Anda pergi",
					"n6": "Lokasi anda jauh dari restoran. Sila ordernya di restoran.",
					"n7": "Saya telah tiba di kedai dan mendapatkan semula kedudukan saya",
					"n8": "Welcome Welcome",
					"n9": "Mula pesanan",
					"n10": "Bayaran dalam talian",
					"n11":"Jadual semasa disimpan, sila hubungi pelayan untuk membuka jadual.",
					"n12":"Panggil pelayan"
				}
			}

			//开启websookid
			if(connect_b) {
				connect();
			}
			delCookie("other");

			$("#gps_box").on('touchmove', function(e) {
				e.preventDefault();
			})
			var yuyue = false;
			var defaultfun = function() {

				//如果id不相同删除购物车
				var getcart = localStorage.getItem("cart_obj")
				if(getcart != null) {
					var getcartID = JSON.parse(getcart).member_id;
					//alert(getCookie("yingsoft_home_member_id")+"--"+getcartID)
					if(getCookie("yingsoft_home_member_id") != getcartID) {

						localStorage.removeItem("cart_obj")
					}
				}

				//alert(getCookie("yingsoft_home_member_id"))
				//加载店铺信息

				//加载数据
				global_ajax(jsonpath + "get_shop_home", {}, function(e) {
					localStorage.setItem("get_shop_home", JSON.stringify(e));
					//设置是否分布点餐
					localStorage.setItem("fenbu_diancan", e.result.shop_info.is_dcfb_bt);
					setindexpage.start(e);
					//弹窗
					$("#pay-box-html").html(template("pay-box-teml", {
						l: serroot_lange[getCookie("language")]
					})) //调用预约占用模板
					//餐桌被预约占用
					if(e.result.is_subscribe) {
						$("#yuyuezhanyong").on('touchmove', function(e) {
							e.preventDefault();
						})
						$("#yuyuezhanyong").html(template("yuyuezhanyong_js", {
							l: lange
						})) //调用预约占用模板
					}

					global_ajax(jsonpath + "get_shop_ver", '', function(ee) {
						//localStorage.removeItem("key1");
						if(localStorage.getItem("ver") != ee.result.ver) {
							localStorage.removeItem("key1");
							localStorage.removeItem("cart_obj");
							localStorage.setItem("ver", ee.result.ver);

						} else {
							//读取缓存
							//setindexpage.start(JSON.parse(localStorage.getItem("get_shop_home")))
						}
						setmenu();
					})

				});

			}

			//获取到GPS后设置距离
			var setJULIN = ""

			function setgpsjuli(s) {
				setJULIN = s;
				$("#gpsjuli").html(s);
			}
			//渲染数据
			var setindexpage = {
				start: function(ee) {
					var ee = ee;
					console.log(ee);
					//判断是否开启定位
					//			if(ee.result.shop_info.is_position_user=="1"){
					//				
					//          	localStorage.setItem("gpsset",1);
					//          	
					//          	//end
					//          }else{
					//          	localStorage.removeItem("gpsset");
					//          	
					//          }
					gpscall() //直接回调
					delCookie("gps");
					setmap1(1);
					var sgps = ee.result.shop_info.position.split(","); //店铺gps
					//设置gps
					//错误回调
					setindexpage.start["error1"] = function() {
						ee.result.juli = lange[1188];
						setgpsjuli(lange[1188]); //重置距离
						//判断是否开启定位
						if(ee.result.shop_info.is_position_user == "1") {
							$("#gps_box").html(template("gps_box_js1", {
								l: serroot_lange[getCookie("language")]
								//								l: serroot_lange[localStorage.getItem("lg")]

							})) //调用错误模板
							//重新获取
							$("#open_gps").on("click", function() {
								$.toast("loading", "text")
								setmap1(1);
							});
						}

					}

					//成功回调
					setindexpage.start["success1"] = function() {
						mygps = getCookie("gps").split(",")
						var kms = getGreatCircleDistance(mygps[0], mygps[1], sgps[0], sgps[1]);
						var km = kms;
						if(km > 1000) {
							km = toFixed2(Math.floor(km) / 1000, 1) + "Km"
						} else {
							km = Math.floor(km) + "m"
						}
						ee.result.gps = getCookie("gps")
						//		 			ee.result.juli=km;
						//		 			setgpsjuli(km);//重置距离
						//		 			
						if(sgps[1] != undefined) {
							ee.result.juli = km;
							setgpsjuli(km); //重置距离
						} else {
							ee.result.juli = lange[1188];
							setgpsjuli(lange[1188]); //重置距离
						}

						//alert("成功")
						//判断是否开启定位
						if(ee.result.shop_info.is_position_user == "1") {
							//重启加载
							if(localStorage.getItem("reload_gps") == "1") $.toast("loading", "text")

							if(kms > 200) {
								console.log("调用距离模板")
								$("#gps_box").html(template("gps_box_js2", {
									"km": km,
									"name": ee.result.shop_info.shop_name,
									l: serroot_lange[getCookie("language")],
									"gps_l": mygps[0],
									"gps_x": mygps[1]
								})) //调用距离模板
								//重新获取
								$("#reload_gps").on("click", function() {
									setmap1(1);
									localStorage.setItem("reload_gps", "1")
								});

							} else {
								if(localStorage.getItem("reload_gps") == "1") {
									$("#gps_box").html(template("gps_box_js3", {
										"km": km,
										"name": ee.result.shop_info.shop_name,
										l: serroot_lange[getCookie("language")]
									})) //调用开始点餐模板
									//重新获取
									$("#reload_close").on("click", function() {
										$("#gps_box").html("");
									});
								}
							}

							localStorage.removeItem("reload_gps");
						}

					}
					//设置gps回调
					function gpscall() {
						localStorage.setItem("beizhu", JSON.stringify(ee.result.beizhu)) //设置备注缓存
						if(!isAPP) {
							ee.result.point = localStorage.getItem("point"); //设置为登录用户积分
						}
						ee.result.oss = oss;
						//console.log(ee.result)
						localStorage.setItem("shop_table_name", ee.result.shop_table_name)
						$("#roo_warp").html(template("root-js", ee.result));
						setlange_obj();

						selectLanguage(function(e) {
							localStorage.removeItem("key1");
							defaultfun(); //设置菜谱缓存
						}) //语言选择下拉

						//是否显示领取积分按钮 判断是否为用户
						if(ee.result.member_info.username != "") {
							$("#getpoint").hide();
							localStorage.setItem("Isusernam", 1)
						} else {
							$("#getpoint").show();
							localStorage.removeItem("Isusernam")
						}

						//是否微信
						console.log(isWeiXin())
						if(isWeiXin()) {
							$(".game_weix").show();
						} else {
							$(".game_app").show();
						}
						$(".game-list .g1").on("click", function() {
							window.location.href = "http://api.foodie.vc/game/hmk/?from=app&r=" + Math.random()
						})
						$(".game-list .g2").on("click", function() {
							window.location.href = "http://api.foodie.vc/game/cjmla/?from=app&r=" + Math.random()
						})

						//头部滚动
						var sctop = $("#scroll_top"),
							sysgg = $("#sys_notice"),
							sctop_w = sctop.width(),
							sctop_f_w = sctop.find("p").width();
						if(sctop_f_w > sctop_w) {
							//      		setInterval(setcroll,5000);
							//      		function setcroll(){
							//      			sctop.find("p").css("left",0)
							//      			sctop.find("p").animate({"left":-100},4000,"linear")
							//      		}
							//      		setcroll()
						}
						//隐藏公告
						sysgg.find(".close").on("click", function() {
							sysgg.remove();
							$(".sys_notice_height").remove();
						})

						//展开公告
						sctop.on("click", function() {
							if(sctop.find(".neirong").html() == "") {
								global_ajax(jsonpath + "gonggao", {
									"id": ee.result.gonggaoid
								}, function(e) {
									sctop.find(".neirong").html(e.result.content)
								})
							}
							sctop.toggleClass("open");
						})
						//end
						//

						$("img").each(function() {
							var $th = $(this),
								src = $(this).data("src");
							console.log($th.is(":visible"))
							if(src && $th.is(":visible")) {
								if(src.indexOf("?") != -1) {
									$(this).attr("src", src + "&" + localStorage.getItem("setver"));
								} else {
									$(this).attr("src", src + "?" + localStorage.getItem("setver"));
								}

							}
						});

						localStorage.setItem("shop_language", JSON.stringify(ee.result.shop_info.shop_language_list)) //设置店铺支持语言选项
						localStorage.setItem("pax", ee.result.pax) //设置当前点餐人数
						//设置多菜谱

						var setcookbook = ee.result.cookbook_list,
							setselectmenu = ee.result.cookbook_id,
							setmenumore = ee.result.shop_info.is_more_cookbook

						//设置是否多菜谱同时点餐
						if(setmenumore == "1") {
							localStorage.setItem("setmenumore", "1")
						} else {
							localStorage.removeItem("setmenumore")
						}

						$.each(setcookbook, function(i, v) {

							//判断是否允许多选
							if(setmenumore != "1") {
								//判断是否锁定菜谱
								if(setselectmenu == 0) {
									v.is_select = 1;
									//console.log(0)
								} else {
									if(v.id == setselectmenu) {
										v.is_select = 1;
										//console.log(1)
									} else {
										v.is_select = 0;
										//console.log(2)
									}
								}
							} else {
								v.is_select = 1;
							}

							var time_is = 0 //时间是否可用
							if(vartime == undefined) {
								vartime = Date.parse(new Date()) / 1000
							}
							//console.log(time_is)
							if(v.begin_time > 0 && v.end_time > 0 && !time_is) {
								time_is = rettime1(v.begin_time, v.end_time, vartime);

								if(v.begin_time1 > 0 && v.end_time1 > 0 && !time_is) {
									time_is = rettime1(v.begin_time1, v.end_time1, vartime);

									if(v.begin_time2 > 0 && v.end_time2 > 0 && !time_is) {
										time_is = rettime1(v.begin_time2, v.end_time2, vartime);

									}
								}
							} else {
								time_is = 1;
							}
							//console.log(time_is)
							if(time_is == 1) {
								//console.log(v.week)
								if(v.week != "") {
									var nwerk = new Date();
									nwerk.setTime(vartime * 1000);
									var mwk = v.week,
										gw = getweek(nwerk);
									console.log(mwk.indexOf(gw))
									if(mwk.indexOf(getweek(nwerk)) == -1) {
										time_is = 0;
									}
								} else {
									time_is = 1;
								}
							}

							v.time_is = time_is;

						});

						localStorage.setItem("cookbook_list", JSON.stringify(setcookbook)) //设置可用菜谱

						//返回时分秒时间戳字符串字符串
						function time1(s) {
							var nn = new Date();
							nn.setTime(s * 1000);
							return nn.format("hhmmss");
						}
						//判断是否设置了时间
						function rettime1(s, d, c) {
							var time_is = 1;
							var beg = time1(s), //开始
								end = time1(d), //结束
								cur = time1(c); //当前	
							//console.log(beg , cur, end)
							if(end > beg) {
								//如果结束时间大于开始时间
								if(beg < cur && end > cur) {
									time_is = 1;
								} else {
									time_is = 0
								}

							} else {
								//隔天
								if(beg > cur && end < cur) {
									time_is = 1;
								} else {
									time_is = 0;
								}
							}
							return time_is;
						}

						if(setcookbook.length > 1) {
							$(".root-bon .bon1 a").attr("href", "javascript:;")
							$(".root-bon .bon1 a").on("click", function() {
								$("#menu-cookbook").remove();

								//排序
								function sortId(a, b) {
									if(b.time_is == a.time_is && b.is_table == a.is_table && b.is_select != a.is_select) {
										return b.is_select - a.is_select
									} else if(b.time_is == a.time_is && b.is_table != a.is_table && b.is_select == a.is_select) {
										return b.is_table - a.is_table
									} else if(b.time_is != a.time_is && b.is_table == a.is_table && b.is_select == a.is_select) {
										return b.time_is - a.time_is
									}
								}
								setcookbook.sort(sortId);

								$("#roo_warp").append(template("menu-list", {
									"cookbook_list": setcookbook
								}));

								$("#menu-cookbook").find("a").on("click", function() {
									var $th = $(this);
									localStorage.setItem("cookbook", $th.data("cookbook"))
									Q.go("select-html");
								});

								$("#menu-cookbook .list-scroll").css({
									"max-height": $(window).height() * 0.8
								})
								$("#menu-cookbook .box").css("margin-top", 0 - $("#menu-cookbook .box").height() / 2.4)
								setlange_obj();
								//关闭菜谱层
								$("#menu-cookbook .close , #menu-cookbook ").on("click", function() {
									$("#menu-cookbook").remove();
								})
							})
						} else {
							$(".root-bon .bon1 a").on("click", function() {
								var $th = $(this);
								localStorage.setItem("cookbook", $th.data("cookbook"))
								Q.go("select-html");
							})
						}

						$("#languages").on("click", function() {
							$(".select-inp").select("open", function() {})
						})

						//不是APP隐藏返回按钮
						if(isAPP) {
							$(".table-top .black").show()
						} else {
							$(".table-top .black").hide()
						}

						//点击呼叫
						$("#hujiao").click(function() {
							var $th = $(this);
							if($th.hasClass("open")) return false;
							$th.addClass("open");
							global_ajax(jsonpath + "put_call_waiter", '', function(e) {
								var s1 = 30;
								$.toast(lange["1044"], "text");
								var s2 = setInterval(function() {
									s1--;
									$th.find(".p2 em").text(s1 + "s");
									if(s1 <= 0) {
										$th.removeClass("open")
										clearInterval(s2);
									}
								}, 1000)
							})
						})

						//点击呼叫买单
						$("#maidan").click(function() {
							var $th = $(this);
							if($th.hasClass("open")) return false; //是否已经点击过按钮
							if(isAPP) {
								elastic(); //开启选择
							} else {
								maidan_fun();
							}
						})
						$("#pay-box").click(function() {
							close_elastic();
						})
						$("#elastic-layer").click(function() {
							close_elastic();
						})
						//查看已点 #!order_see-html
						$("#yidian").click(function() {
							var $th = $(this);
							if($th.hasClass("null")) return false;
							Q.go("order_see-html");
						})

					}

				}
			}

			//缓存菜品列表
			function setmenu() {

				if(localStorage.getItem("key1") == null) {
					var setlangua = getCookie("language")
					if(localStorage.getItem("shop_language").indexOf('"' + setlangua + '"') == -1) setlangua = "en";
					$.ajax({
						type: "get",
						dataType: "json",
						timeout: 20000,
						url: oss + "/shop_goods/" + getCookie("shopid") + "_" + setlangua + ".json",
						cache: false,
						success: function(e) {
							//设置返回值
							localStorage.setItem("key1", JSON.stringify(e))
							var key2 = {},
								key3 = {},
								key4 = {},
								key5 = {};
							$.each(e.result.list, function(i, v) {
								if(v.id == 1 || v.id == 2) {} else {
									$.each(v.goods_list, function(ii, vv) {
										key2[vv.id] = vv;
									})
								}
							});

							$.each(e.result.spec_list, function(iii, vvv) {
								key3[vvv.spec_id] = vvv;
							})
							$.each(e.result.taste_list, function(iii, vvv) {
								key4[vvv.taste_id] = vvv;
							})
							$.each(e.result.garnish_list, function(iii, vvv) {
								key5[vvv.garnish_id] = vvv;
							})
							//设置菜品
							localStorage.setItem("key2", JSON.stringify(key2))
							localStorage.setItem("key3", JSON.stringify(key3))
							localStorage.setItem("key4", JSON.stringify(key4))
							localStorage.setItem("key5", JSON.stringify(key5))
							caidan_json = key2;
							guige1_json = key3;
							kouwei1_json = key4;
							peicai_json = key5;
						},
						error: function() {
							$.modal({
								title: "tips",
								text: "Loading error",
								buttons: [{
									text: "Refresh",
									onClick: function() {
										location.reload(true)
									}
								}]
							});
						}
					})
				}

			}

			//setmap1(2);
			//初始化加载
			defaultfun();

			//	var set_setmap2=0;
			//	var set_setmap1=setInterval(function(){
			//		set_setmap2++;
			//		setmap1(2);
			//		if(set_setmap2==10){
			//			clearInterval(set_setmap1);
			//		}
			//		
			//	},2000)
		</script>
	</div>
</div>